//=============================================================================
// ThermoBlasterAltProjectile.
//=============================================================================
class ThermoBlasterAltProjectile extends TFProjectile
	placeable;

#exec OBJ LOAD FILE=XEffectMat.utx
#exec obj load file=..\Sounds\WeaponSounds.uax

simulated function PostBeginPlay()
{
    local Rotator R;

	Super.PostBeginPlay();

	Velocity = Vector(Rotation);
    Acceleration = Velocity * 3000.0;
    Velocity *= Speed;

    R = Rotation;
    R.Roll = Rand(65536);
    SetRotation(R);

    if ( Level.bDropDetail )
	{
		bDynamicLight = false;
		LightType = LT_None;
	}
}



simulated function PostNetBeginPlay()
{
	if ( Level.bDropDetail || Level.DetailMode == DM_Low )
		LightType = LT_None;
}

simulated function Explode(vector HitLocation, vector HitNormal)
{
	Local xEmitter LFlame;

    if ( EffectIsRelevant(Location,false) )
	{
//            Spawn(class'ThermoBurnB',,, HitLocation, rotator(HitNormal));
	LFlame = Spawn(class'ThermoBurnB');
	LFlame.SetLocation(HitLocation);
	LFlame.SetDrawScale(0.2+Frand());
	}
    PlaySound(Sound'WeaponSounds.PulseRifle.PulseRifleAltFire');
	Destroy();
}

simulated function ProcessTouch (Actor Other, vector HitLocation)
{
    local Vector X, RefNormal, RefDir;

	if (Other == Instigator) return;
    if (Other == Owner) return;

    if (Other.IsA('xPawn') && xPawn(Other).CheckReflect(HitLocation, RefNormal, Damage*0.25))
    {
        if (Role == ROLE_Authority)
        {
            X = Normal(Velocity);
            RefDir = X - 2.0*RefNormal*(X dot RefNormal);
            //Log("reflecting off"@Other@X@RefDir);
            Spawn(Class, Other,, HitLocation+RefDir*20, Rotator(RefDir));
        }
        Destroy();
    }
    else if ( !Other.IsA('Projectile') || Other.bProjTarget)
	{
		if ( Role == ROLE_Authority )
			Other.TakeDamage(Damage ,Instigator,HitLocation,MomentumTransfer*Normal(Velocity),MyDamageType);
		Explode(HitLocation, vect(0,0,1));
	}
}

defaultproperties
{
     Speed=5000.000000
     MaxSpeed=6000.000000
     Damage=8.000000
     MomentumTransfer=5000.000000
     MyDamageType=Class'Taskforces.DamTypeThermoBlast'
     ExplosionDecal=Class'XEffects.LinkBoltScorch'
     LightHue=25
     LightSaturation=120
     LightBrightness=120.000000
     LightRadius=3.000000
     DrawType=DT_StaticMesh
     StaticMesh=StaticMesh'TFMedia.ThermoBlast'
     bDynamicLight=True
     AmbientSound=Sound'WeaponSounds.LinkGun.LinkGunProjectile'
     LifeSpan=4.000000
     DrawScale=0.300000
     DrawScale3D=(X=3.500000)
     PrePivot=(X=10.000000)
     Skins(0)=FinalBlend'TFMedia.ThermoBlaster.ThermoBlasterBeamFB'
     AmbientGlow=217
     SoundVolume=255
     SoundRadius=50.000000
     bFixedRotationDir=True
     RotationRate=(Roll=80000)
     ForceRadius=30.000000
     ForceScale=5.000000
}
